using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Xid.Controls;
using Xeml.Document;
using Xeml.Document.Contracts;
using ComponentFactory.Krypton.Toolkit;

namespace XemlInteractiveDesigner
{
    public partial class SamplingStrategyForm : KryptonForm
    {

        public List<SampleTemplate> Templates
        {
            get { return samplingStrategyCtrl1.CalculateTemplates(); }
        }

        public SamplingStrategyForm(IDocument xemlDoc)
        {
            InitializeComponent();
            samplingStrategyCtrl1.PopulateIndividualPools(xemlDoc);
        }

        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (samplingStrategyCtrl1.IsValidTemplate)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
                MessageBox.Show("Incomplete sampling template. Please define at least one group of genotype with at least one material term.", "Invalid template", MessageBoxButtons.OK);

        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}